import { api } from '@/servers/api'
import { getData, postData, postFile, putData } from '@/servers/http'
import type { RainbowDataType } from './interface'

/** 获取生涯彩虹图数据 */
export const info = () => getData(api.rainbowRoles)

/** 上传图片 */
export const uploadFile = (file: File) => postFile(api.uploads, { type: 'img', file })

/** 保存生涯彩虹图数据 */
export const save = (data: RainbowDataType[], url: string) => postData(api.rainbowRoles, { data, url })

/** 同步实训结果 */
export const syncTrainData = (id: string) => putData(`${api.userBarriersBatchUpdate}${id}`, { fill_type: 3 })
